<template>
	<view>
		<u-tabs :list="tabsm" @click="clicktabsm" :current="tab_currentsm" :scrollable="false"
			:activeStyle="{color:'#6dc19c'}" lineColor="#6dc19c"></u-tabs>
		<abnor v-if="list.length<=0"></abnor>

		<view class="shop_list">
			<view class="shop_list_sm" v-for="(item,index) in list" :key="index">
				<view class="shop_list_sm_left">
					<view class="shop_tit" style="margin-bottom: 16rpx;">有效期：{{item.stime}}<text style="margin:0 8rpx;"> -- </text>{{$u.timeFormat(item.etime, 'yyyy-mm-dd')}}</view>
					<view class="shop_tit" style="margin-bottom: 16rpx;">
						订单号:{{item.order.order_code}}
					</view>
					<view>
						<view class="shop_tit">项目名称:{{item.maintenance.service.title}}</view>
						<view style="display: flex;align-items: center;margin-top: 16rpx;">
							<text>门店:{{item.store.title}}</text>
						</view>
					</view>
					<view class="" style="display: flex;align-items: center;justify-content: space-between;">
						<view class="btn" style="width: 100%;" @click="go(index)">请邀请你的伙伴</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions,
		mapMutations
	} from "vuex"
	export default {
		data() {
			return {
				list: [],
			}
		},
		computed: mapState({
			primaryColor: state => state.config.configInfo.primaryColor,
			subColor: state => state.config.configInfo.subColor,
			configInfo: state => state.config.configInfo,
			commonOptions: state => state.user.commonOptions,
			mineInfo: state => state.user.mineInfo,
			carList: state => state.order.carList,
		}),
		onLoad() {
			this.getuserInfo()
		},
		onShow() {
			this.gettreatInvorderList();
		},
		methods: {
			async getuserInfo() {
				var res = await this.$api.mine.index()
				this.userInfo = res
			},
			async gettreatInvorderList() {
				this.$util.showLoading()
				var list = await this.$api.shareholder.userMaintenanceInv();
				list.map(item => {
					let time = item.create_time.split(' ')[0]
					let times = new Date(time).getTime()
					var date = new Date(time);
					// 将日期增加7天
					date.setDate(date.getDate() + 7);
					// 获取时间戳（毫秒）
					var timestamp = date.getTime();
					item.stime = time
					item.etime = timestamp
				})
				this.list = list;
				this.$util.hideAll()
			},
			go(index){
				let obj = this.list[index]
				uni.navigateTo({
					url:'/zxcadd/about/clock_asd?id='+obj.maintenance_id + '&pin_id='+ obj.id
				})
			},
		}
	}
</script>

<style lang="scss">
	.shop_list_sm {
		width: 92%;
		padding: 30rpx;
		border-radius: 20rpx;
		background-color: #fff;
		margin: 30rpx auto 0;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.shop_list_sm_left {
		width: 100%;
	}

	.shop_list_sm_right {
		width: 200rpx;
		height: 200rpx;
		border-radius: 20rpx;
	}

	.shop_tit {
		font-size: 30rpx;
		font-weight: 700;
		color: #000;
	}

	.shop_txt {
		color: #454545;
		font-size: 24rpx;
		margin-top: 20rpx;
	}

	.shop_bt {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 20rpx;
		color: #454545;
		font-size: 24rpx;
	}

	.money {
		color: #ff4a00;
		font-size: 33rpx;
		font-weight: 700;
	}

	.btn {
		background-color: #3ebf87;
		color: #fff;
		border-radius: 10rpx;
		padding: 10rpx 0;
		text-align: center;
		margin-top: 15rpx;
	}

	.label_l {
		font-size: 30rpx;
		font-weight: 700;
		border-left: 10rpx solid #07c160;
		padding-left: 10rpx;
		margin: 10rpx 0;
	}

	.btns {
		background-color: #07c160;
		color: #fff;
		border-radius: 18rpx;
		text-align: center;
		width: 80%;
		margin: 30rpx auto 0;
		padding: 20rpx 0;
		font-size: 28rpx;
	}

	.pay-info {
		height: 110rpx;
		bottom: 0;
		height: calc(110rpx + env(safe-area-inset-bottom) / 2);
		padding-bottom: calc(env(safe-area-inset-bottom) / 2);

		.pay-btn {
			width: 182rpx;
			height: 74rpx;
		}
	}
</style>